package orbito.physics.collision;

public class Interval {
	double min, max;
	
	public Interval(double min, double max) {
		this.min = min;
		this.max = max;
	}
	
	public double getDistance(Interval other) {
		if (this.min < other.min) {
			return other.min - this.max;
		} else {
			return this.min - other.max;
		}
	}
	
	public boolean intersects(Interval other) {
		return getDistance(other) < 0;
	}
}
